#define _CRT_SECURE_NO_WARNINGS


#include<stdio.h>

int main()
{
    int N = 5;
    int K;
    int arr1[5], arr2[5];
    for (int i = 0; i < N; i++)
    {
        scanf("%d", &arr1[i]);
    }
    scanf("%d", &K);
    int sum = 0;
    for (int i = 0; i < K; i++)
    {
        int flag = 0;
        for (int j = 0; j < N; j++)
        {
            scanf("%d", &arr2[j]);
            sum += arr2[j];
            if ((arr2[j] == 0) || (arr1[j] == arr2[j]))
                flag = 1;
            else
            {
                flag = 0; break;
            }
        }
        if (flag = 0 || sum == 0)
            printf("Ai Ya\n");
        else
            printf("Da Jiang!!!\n");
    }
    return 0;
}


